#%RAML 0.8
title: Acquisitions
version: v1
baseUri: http://github.com/org/folio/lsp-apis
protocols: [ HTTPS ]

documentation:
  - title: Acquisitions API
    content: <b>This documents the API calls that can be made for users to fulfill Acquisitions functionality</b>

schemas:
  - fund.schema: !include ../_schemas/fund.schema
  - funds: !include ../_schemas/funds.schema
  - invoice.schema: !include ../_schemas/invoice.schema
  - invoices: !include ../_schemas/invoices.schema
  - invoice_line.schema: !include ../_schemas/invoice_line.schema
  - invoice_lines: !include ../_schemas/invoice_lines.schema
  - po_line.schema: !include ../_schemas/po_line.schema
  - po_lines: !include ../_schemas/po_lines.schema
  - vendor.schema: !include ../_schemas/vendor.schema
  - vendors: !include ../_schemas/vendors.schema

traits:
  - secured: !include ../raml-util/traits/auth.raml
  - orderable: !include ../raml-util/traits/orderable.raml
  - pageable:  !include ../raml-util/traits/pageable.raml
  - searchable: !include ../raml-util/traits/searchable.raml
  - language: !include ../raml-util/traits/language.raml

resourceTypes:
  - collection: !include ../raml-util/rtypes/collection.raml
  - collection-item: !include ../raml-util/rtypes/item-collection.raml
  - get-only: !include ../raml-util/rtypes/get-only.raml

/funds:
  displayName: Funds
  type:
    collection:
      exampleCollection: !include  ../_examples/fund.sample
      exampleItem: !include ../_examples/fund.sample
      schemaCollection: funds
      schemaItem: fund.schema
  get:
    is: [
      searchable: {description: "with valid searchable fields: for example code", example: "[\"code\", \"MEDGRANT\", \"=\"]"},
      orderable: {fieldsList: "field A, field B"},
      pageable
    ]
  /{fundId}:
    type:
      collection-item:
        exampleItem: !include ../_examples/fund.sample
        schema: fund.schema
/invoices:
  displayName: Invoices
  type:
    collection:
      exampleCollection: !include  ../_examples/invoice.sample
      exampleItem: !include ../_examples/invoice.sample
      schemaCollection: invoices
      schemaItem: invoice.schema
  get:
    is: [
      searchable: {description: "with valid searchable fields: for example code", example: "[\"vendor_invoice_number\", \"123456679\", \"=\"]"},
      orderable: {fieldsList: "field A, field B"},
      pageable
    ]
  /{invoiceId}:
    type:
      collection-item:
        exampleItem: !include ../_examples/invoice.sample
        schema: invoice.schema
    /invoice_lines:
      displayName: Invoice lines
      type:
        collection:
          exampleCollection: !include  ../_examples/invoice_line.sample
          exampleItem: !include ../_examples/invoice_line.sample
          schemaCollection: invoice_lines
          schemaItem: invoice_line.schema
      get:
        is: [
          searchable: {description: "with valid searchable fields: for example code", example: "[\"vendor_invoice_number\", \"123456679\", \"=\"]"},
          orderable: {fieldsList: "field A, field B"},
          pageable
        ]
      /{invoice_lineId}:
        type:
          collection-item:
            exampleItem: !include ../_examples/invoice_line.sample
            schema: invoice_line.schema
/po_lines:
  displayName: PO Lines
  type:
    collection:
      exampleCollection: !include  ../_examples/po_line.sample
      exampleItem: !include ../_examples/po_line.sample
      schemaCollection: po_lines
      schemaItem: po_line.schema
  get:
    is: [
      searchable: {description: "with valid searchable fields: for example code", example: "[\"vendor_invoice_number\", \"123456679\", \"=\"]"},
      orderable: {fieldsList: "field A, field B"},
      pageable
    ]
  /{poLineId}:
    type:
      collection-item:
        exampleItem: !include ../_examples/po_line.sample
        schema: po_line.schema
/vendors:
  displayName: Vendors
  type:
    collection:
      exampleCollection: !include  ../_examples/vendor.sample
      exampleItem: !include ../_examples/vendor.sample
      schemaCollection: vendors
      schemaItem: vendor.schema
  get:
    is: [
      searchable: {description: "with valid searchable fields: for example code", example: "[\"vendor_invoice_number\", \"123456679\", \"=\"]"},
      orderable: {fieldsList: "field A, field B"},
      pageable
    ]
  /{vendorId}:
    type:
      collection-item:
        exampleItem: !include ../_examples/vendor.sample
        schema: vendor.schema
